#!/usr/bin/env python
# -*- coding:utf-8 -*-
#/home/zc/workspace/tinyfeet/trunk/src/controllers/weibo2tfeet/queuehandler.py
'''
Created on 2012-4-4

@author: zc
'''
from dbhandle.mysqldb import mysqldb 
from config.sqlmap import SQL_GET_CNTUSER, SQL_GET_WEIBOID
from controllers.utils import tfusers, logger
from controllers.tfeet.updatetfeet_handler import  newTFeet

logger = logger.logger()

dbo = mysqldb()

def queuetfeet( tfeet ):
        try:
            res = dbo.query( SQL_GET_WEIBOID % tfeet['weibo_id'] )
            if res and res[0].cnt == 0 :
                newTFeet( tfeet )
        except Exception, data:
            logger.error( data )
            

def queueuser( user ):
        try:
            res = dbo.query( SQL_GET_CNTUSER % user.id )
            if res and res[0].cnt == 0 :
                rowcount = tfusers.addUser( user )
        except Exception, data:
            logger.error( data )
